package com.onefinger.manager.views.model
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class BaseCRUDModel extends EventDispatcher implements IActionCRUD
	{
		//--------------------------------------------------------------------
		//    Public Constants
		//--------------------------------------------------------------------
		public static const CREATING:String = "creating";
		public static const EDITING:String = "editing";
		public static const PROCESSING:String 	= "processing";
		
		//.................state......................
		private var _stateIndex:String=BaseCRUDModel.CREATING;
		
		[Bindable(Event="stateIndexChange")]
		public function get stateIndex():String
		{
			return _stateIndex;
		}
		
		public function set stateIndex(path:String):void
		{
			_stateIndex=path;			
			dispatchEvent( new Event( "stateIndexChange" ) );
		}
		
		//--------------------------------------------------------------------
		//    Constructor
		//--------------------------------------------------------------------
		protected var dispatcher:IEventDispatcher;
		public function BaseCRUDModel(dispatcher:IEventDispatcher=null)
		{
			this.dispatcher=dispatcher;
		}
		
		public function addNew():void
		{
			//Implement in subclass
		}
		
		public function cancel():void
		{
			//Implement in subclass
		}
		
		public function edit(object:Object):void
		{
			//Implement in subclass
		}
		
		public function remove():void
		{
			//Implement in subclass	
		}
		
		public function select(object:Object):void
		{
			//Implement in subclass	
		}
		
		public function unselect():void
		{
			//Implement in subclass
		}
		
		public function update():void
		{
			//Implement in subclass
		}
		
		
		
	}
}